package cn.itcast.search.mq;

import cn.itcast.search.constatnts.MqConstants;
import cn.itcast.search.service.SearchService;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class ItemListener {
    @Autowired
    private SearchService searchService;
    //监听上架
    @RabbitListener(queues = MqConstants.HOTEL_INSERT_QUEUE)
    public void upGoods(Long id) {

        searchService.downGoods(id);
    }
    //监听下架
    @RabbitListener(queues = MqConstants.HOTEL_DELETE_QUEUE)
    public void downGoods(Long id) {

        searchService.deleteGoods(id);
    }
}
